function oil = osl_save_oil(oil)

% [oil] = osl_save_oil(oil)
%
% save OIL structure to the file oil.fname=[oil.source_recon.dirname '/oil_' oil.enveloping.name '_' oil.concat_subs.name '_' oil.ica.name ]

if(isempty(findstr(oil.source_recon.dirname, '.oil')))
    oil.source_recon.dirname=[oil.source_recon.dirname, '.oil']; 
end;

oildir=[oil.source_recon.dirname '/oil_' oil.enveloping.name '_' oil.concat_subs.name '_' oil.ica.name];
if ~isdir(oildir); mkdir(oildir); end
oil.fname = [oildir '/oil.mat'];
save(oil.fname, 'oil');
